package com.example;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/6/1
 */
// 开门状态
class DoorOpenState implements ElevatorState {
    private Elevator elevator;

    public DoorOpenState(Elevator elevator) {
        this.elevator = elevator;
    }

    @Override
    public void moveToFloor(int floor) {
        System.out.println("电梯门开着，不能移动");
    }

    @Override
    public void openDoor() {
        System.out.println("电梯门已经打开");
    }

    @Override
    public void closeDoor() {
        System.out.println("电梯门正在关闭");
        elevator.changeState(new DoorClosedState(elevator));
    }

    @Override
    public void markFault() {
        System.out.println("电梯门开着时发生故障，停止运行");
        elevator.changeState(new FaultState(elevator));
    }

    @Override
    public void fixFault() {
        System.out.println("电梯没有故障，无需修复");
    }
}
